{# SPDX-FileCopyrightText: © 2015 Siemens AG

   SPDX-License-Identifier: FSFAP
#}
<spdx:relationship>
  <spdx:Relationship>
    <spdx:relationshipType rdf:resource="http://spdx.org/rdf/terms#relationshipType_describes" />
    <spdx:relatedSpdxElement>
      <spdx:Package rdf:about="#SPDXRef-upload{{ packageId|url_encode }}">
        <spdx:name>{{ packageName }}</spdx:name>
        <spdx:packageFileName>{{ uploadName }}</spdx:packageFileName>
        <spdx:downloadLocation rdf:resource="http://spdx.org/rdf/terms#noassertion" />
        <spdx:versionInfo>{{ packageVersion|e }}</spdx:versionInfo>
        {%- if releaseDate is not empty ~%}
        <spdx:releaseDate>{{ releaseDate }}</spdx:releaseDate>
        {%- endif ~%}
        <spdx:filesAnalyzed>true</spdx:filesAnalyzed>
        {%- if componentId is not empty ~%}
        <spdx:externalRef>
          <spdx:ExternalRef>
            <spdx:referenceCategory rdf:resource
              ="http://spdx.org/rdf/terms#referenceCategory_packageManager" />
            <spdx:referenceType rdf:resource
              ="http://spdx.org/rdf/references/{{ componentType }}" />
            <spdx:referenceLocator>{{ componentId|trim }}</spdx:referenceLocator>
          </spdx:ExternalRef>
        </spdx:externalRef>
        {%- endif ~%}
        <spdx:packageVerificationCode>
          <spdx:PackageVerificationCode>
          <spdx:packageVerificationCodeValue>{{ verificationCode }}</spdx:packageVerificationCodeValue>
          </spdx:PackageVerificationCode>
        </spdx:packageVerificationCode>
        <spdx:checksum>
          <spdx:Checksum>
            <spdx:algorithm rdf:resource="http://spdx.org/rdf/terms#checksumAlgorithm_sha1" />
            <spdx:checksumValue>{{ sha1 | lower }}</spdx:checksumValue>
          </spdx:Checksum>
        </spdx:checksum>
        <spdx:checksum>
          <spdx:Checksum>
            <spdx:algorithm rdf:resource="http://spdx.org/rdf/terms#checksumAlgorithm_sha256" />
            <spdx:checksumValue>{{ sha256 | lower }}</spdx:checksumValue>
          </spdx:Checksum>
        </spdx:checksum>
        <spdx:checksum>
          <spdx:Checksum>
            <spdx:algorithm rdf:resource="http://spdx.org/rdf/terms#checksumAlgorithm_md5" />
            <spdx:checksumValue>{{ md5 | lower }}</spdx:checksumValue>
          </spdx:Checksum>
        </spdx:checksum>
{% if mainLicenses|length > 1 %}
        <spdx:licenseConcluded>
{% if 'Dual-license' in mainLicenses and mainLicenses|length > 2 %}
          <spdx:DisjunctiveLicenseSet>
{% else %}
          <spdx:ConjunctiveLicenseSet>
{% endif %}
{% for res in mainLicenses %}
{% if res starts with 'LicenseRef-' %}
            <spdx:member rdf:resource="#{{ res|replace({' ': '-'})|url_encode }}" />
{% else %}
            <spdx:member rdf:resource="http://spdx.org/licenses/{{ res|replace({' ': '-'})|url_encode }}" />
{% endif %}
{% endfor %}
{% if 'Dual-license' in concludedLicenses and concludedLicenses|length > 2 %}
          </spdx:DisjunctiveLicenseSet>
{% else %}
          </spdx:ConjunctiveLicenseSet>
{% endif %}
        </spdx:licenseConcluded>
{% elseif mainLicenses|length == 1 %}
{% set res = mainLicenses[0] %}
{% if res starts with 'LicenseRef-' %}
        <spdx:licenseConcluded rdf:resource="#{{ res|replace({' ': '-'})|url_encode }}" />
{% else %}
        <spdx:licenseConcluded rdf:resource="http://spdx.org/licenses/{{ res|replace({' ': '-'})|url_encode }}" />
{% endif %}
{% endif %}
        {% if licenseComments %}<spdx:licenseComments><![CDATA[
          {{ licenseComments|replace({']]>':']]><![CDATA[>'}) }}
        ]]></spdx:licenseComments>
        {% endif %}<spdx:licenseDeclared rdf:resource="http://spdx.org/rdf/terms#noassertion" />
        <spdx:licenseInfoFromFiles rdf:resource="http://spdx.org/rdf/terms#noassertion" />
        <spdx:copyrightText rdf:resource="http://spdx.org/rdf/terms#noassertion" />
        {%- if generalAssessment is not empty ~%}
        <rdfs:comment><![CDATA[
          {{ generalAssessment|replace({']]>':']]><![CDATA[>'}) }}
        ]]></rdfs:comment>
        {%- endif ~%}
{% for obligation in obligations  %}
        <spdx:attributionText><![CDATA[{{ obligation|replace({'\f':''})
                |replace({']]>':']]]]><![CDATA[>'}) }}]]></spdx:attributionText>
{% endfor %}
        {{ fileNodes|replace({'\n':'\n        '}) }}
      </spdx:Package>
    </spdx:relatedSpdxElement>
  </spdx:Relationship>
</spdx:relationship>
